<template>
  <view class="content">
    <intake-nav-bar :title="title" dark :fixed="true" color="#000"/>
    <jyf-parser :html="content" ref="article" :tag-style="tagStyle"></jyf-parser>
  </view>
</template>

<script>
import parser from "@/components/jyf-parser/jyf-parser";
import {
  getUserAgreement,
} from '@/api/user.js';
export default {
  components: {
    "jyf-parser": parser
  },
  data() {
    return {
      tagStyle: {
        img: 'width:100%;display:block;',
        table: 'width:100%',
        video: 'width:100%'
      },
      title:'',
      content: ``
    }
  },
  onLoad(options) {
    console.log(options)
    let {
      type
    } = options;
    type = parseInt(type); // 0 ==> 服务协议 1 ==> 隐私政策 2 ==> 售后保障
    this.title = type === 4?'用户协议':'隐私协议'
    console.log("type",type)

    this.getServerProtoFun(type);
  },
  methods:{
    getServerProtoFun(type){
      let that = this;
      getUserAgreement(type).then(res => {
        that.content = res.data.content
        uni.setNavigationBarTitle({
          title: res.data.title
        });
      }).catch(err => {
        that.$utils.Tips({
          title: err
        });
      })
    }
  }

}
</script>

<style scoped>
page {
  background-color: #fff;
}

.content {
  padding: 40rpx 30rpx;
  line-height: 2;
  font-size: 12rpx;
}
</style>
